package com.wwj.tem.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wwj.tem.mapper.SysRoleMapper;
import com.wwj.tem.model.entity.SysUserRole;
import com.wwj.tem.service.SysUserRoleService;
import com.wwj.tem.mapper.SysUserRoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Home
 * @description 针对表【sys_user_role】的数据库操作Service实现
 * @createDate 2024-07-28 17:27:23
 */
@Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole>
		implements SysUserRoleService {
	
	@Resource
	private SysUserRoleMapper sysUserRoleMapper;
	
	@Resource
	private SysRoleMapper sysRoleMapper;
	
	// 根据用户ID查询角色ID列表
	@Override
	public List<Long> getRoleIdsByUserId(Long userId) {
		return sysUserRoleMapper.selectRoleIdsByUserId(userId);
	}
	
	// 根据用户ID查询角色编码列表
	@Override
	public List<String> getRoleCodesByUserId(Long userId) {
		List<Long> roleIds = getRoleIdsByUserId(userId);
		return sysRoleMapper.selectRoleCodesByIds(roleIds);
	}
}




